package com.examples {
	import flash.display.Sprite;
	import flash.geom.Matrix;
	import flash.geom.Point;

	/**
	 * @author blake
	 */
	public class PointTest extends Sprite {
		private	var rect : Sprite;

		public function PointTest() {
			createRect();
			skewMatrix();
		}

		private function createRect() : void {
			rect = new Sprite();
			rect.graphics.lineStyle(1, 0x000000);
			rect.graphics.beginFill(0x00ff00, 0.4);
			rect.graphics.drawRect(0, 0, 100, 50);
			rect.graphics.endFill();
			addChild(rect);
		}

		public function deg2Rad(deg : Number) : Number {
			return deg * Math.PI / 180;
		}

		public function skewMatrix() : void {
			var mtrx : Matrix = rect.transform.matrix;
			mtrx.c = Math.tan(deg2Rad(-20));
			rect.transform.matrix = mtrx;
			rect.x -= mtrx.deltaTransformPoint(new Point(0,50)).x;
			trace(mtrx.transformPoint(new Point(0,50)));
		}
	}
}
